home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / mtz / mtz src / mz mods < prev    next >
Encoding:
Text File  |  1992-12-13  |  10.0 KB  |  407 lines  |  [TEXT/KAHL]

  1. Ok, this ia an attempt to tell you what I have done to the arashi src code
  2. so that some of it may be added to the src possibly.
  3.  
  4.  
  5.  
  6. To give an extra life at every 20,000 I did the following.....
  7.  
  8. In STPlayer.c
  9.  
  10. #define freeLifeScore    (20000) /* (mz) */
  11.  
  12. void    IncreaseScore(points)
  13. long    points;
  14. {
  15.     
  16.     int            flashcount;
  17.                 
  18.     Hero.score+=points;
  19.     Hero.drawscore= 1;
  20.     if (Hero.score > Hero.freeLives)     /* check for free life (mz) */
  21.     {    
  22.         PlayB(ZZFreeLife,999);          /* play free life sound (mz) */
  23.         if(!PlayOptions->noLoudSounds)
  24.             PlayA(ZZFreeLife,999);
  25.         Hero.NewLifeColorInvert=1;        /* set flash flag (mz) */
  26.         AddLife();
  27.         Hero.freeLives = Hero.score - (Hero.score % freeLifeScore) + freeLifeScore;
  28.         /* round score up to next interval */
  29.     }
  30. }
  31. The free life sound was added to STORM.h
  32. added to the end of the list...
  33.  
  34.             Whiz,        /*    Flying plasma        */
  35.             Zroom,        /*    Splitting tanker    */
  36.             ZZFreeLife    /*     Chime for free life    (mz) */
  37.             
  38.         };
  39.  
  40. To cause a flash after a Free Life, in UpdatePlayer()
  41.  
  42.     /* added check for NLCI to revert colors (mz) */
  43.      if((Hero.superzapping==1 || Hero.NewLifeColorInvert) && Hero.state != HeroFlying) 
  44.     {    
  45.         if ((!(Hero.NewLifeColorInvert)) || (Hero.NewLifeColorInvert==16)) 
  46.         {
  47.             ZapColorsHandle=GetResource('CLOT',ThisLevel.lvColor);
  48.             Hero.NewLifeColorInvert=0;
  49.         }
  50.         else{ /* run through all colors twice to enhance flash (mz) */
  51.             ZapColorsHandle=GetResource('CLOT',(Hero.NewLifeColorInvert & 8));
  52.             Hero.NewLifeColorInvert++;
  53.         }
  54.         VASetColors(ZapColorsHandle);
  55.         ReleaseResource(ZapColorsHandle);
  56.     }
  57.                             
  58. and added 
  59.  
  60. long    freeLives;    /*  Score needed for next free life        (mz)     */
  61. int        NewLifeColorInvert; /* flag for unusual color invert (mz)    */
  62.     
  63. to the Hero structure in STORM.h
  64.  
  65.  
  66. ====================        
  67.                             
  68.                             
  69. To implement the radio buttons for Practice or Arcade restart modes I did...
  70.  
  71. to PlayOptions.h
  72.  
  73. typedef    struct
  74. {
  75.     int        absMoveFlag;
  76.     int        mouseSensitivity;
  77.     int        rotationType;
  78.     int        blankUnused;
  79.     int        monochrome;
  80.     int        soundOff;
  81.     int        noLoudSounds;
  82.     int        verticalGame;
  83.     int        sys607Sound;
  84.     int        restart;                    /* (mz) how to restart */
  85. }    PlayOptionsRecord;
  86.  
  87. in PlayOptions.c
  88.  
  89. StaticHelpScreen,
  90.                             VerticalScreen,
  91.                             Sys607Sound,
  92.     StaticRestartMode,        ArcadeRestart,     /* ( mz) */
  93.                             EasyRestart
  94.         
  95. in DataToRadioButtons()
  96.  
  97.     SetStartItem(ArcadeRestart,        PlayOptions->restart == 0);   /* (mz) */
  98.     SetStartItem(EasyRestart,        PlayOptions->restart == 1);
  99.     
  100.     
  101. in DoStartupDialog()
  102.  
  103.     
  104.         case ArcadeRestart:        PlayOptions->restart=0;                              break;
  105.         case EasyRestart:        PlayOptions->restart=1;                                break;
  106.     
  107.     
  108.  
  109. ===============
  110. The radio buttons were used to affect restart
  111.  
  112. If Easy restart, player can select anything up lvl 96
  113. if Arcade restart, up to highest odd level in the last game.
  114. To affect restart and keep track of the last highest level....
  115.  
  116. in GameLoop.c
  117.  
  118. static     highestLastLevel=9;            /* global (mz) */
  119. .
  120. .
  121. .
  122. } while(Hero.lives>0 || Hero.state != HeroDead);
  123.     
  124.     highestLastLevel = ThisLevel.lvNumber - 2;    /* at end of game save highest level */
  125.  
  126.  
  127. and....
  128.  
  129. long    PlayGame(HighScore,Options)
  130. long    HighScore;
  131. int        Options;
  132. {
  133.     int        i;
  134.     
  135.     Hero.score = -1;
  136.     i=DoLevelSelect(highestLastLevel);            /* transfer variable (mz) */
  137.     if(i>=0)
  138.     {    VA.FrameSpeed=3;
  139.         ThisLevel.lvNext=i;
  140.         GameLoop(Options);
  141.     }
  142.  
  143.     return    Hero.score;
  144. }
  145.  
  146. in STLevelSelect.c
  147.  
  148. #include "PlayOptions.h"
  149.  
  150. typedef    struct
  151. {    
  152.     int            levelresource;
  153.     ColorSpec    levelcolor;
  154.     int            levelnumber;
  155.     int            leveltemplate;
  156.     long        levelbonus;                /* added field (mz) */
  157. }    selectable;
  158.  
  159. int        CreateStable(stable,highestLastLevel)
  160. selectable    *stable;
  161. int    highestLastLevel;                /* new (mz) */
  162. {
  163.     register    int            thislev=128;
  164.     register    int            levcount=0;
  165.     register    int            colorresource;
  166.     register    ColorSpec    **LCTable;
  167.     register    LevelInfo    **LInfo;
  168.     
  169.     do
  170.     {    LInfo=(void *)GetResource('LEVL',thislev);
  171.         if(LInfo==0)                                return levcount;
  172.         
  173.         colorresource = (*LInfo)->lvColor;
  174.         LCTable = (void *)GetResource('CLOT',colorresource);
  175.         stable[levcount].levelresource = (*LInfo)->lvField;
  176.         stable[levcount].levelnumber = (*LInfo)->lvNumber;
  177.         stable[levcount].levelcolor = (*LCTable)[8];
  178.         stable[levcount].leveltemplate=thislev;
  179.         /*    stable[levcount].levelbonus =  (long)(*LInfo)->flPoints*(*LInfo)->flCount + 
  180.             (long)(*LInfo)->puPoints*(*LInfo)->puCount + 
  181.             (long)(*LInfo)->fuPoints*(*LInfo)->fuCount + 
  182.             (long)(300 + ((*LInfo)->tk[0].points) )*(*LInfo)->tk[0].count + 
  183.             (long)(400 + ((*LInfo)->tk[1].points) )*(*LInfo)->tk[1].count + 
  184.             (long)(400 + ((*LInfo)->tk[2].points) )*(*LInfo)->tk[2].count; */
  185.             
  186. The commented out code can be used to generate total score for a level
  187.  
  188.         stable[levcount].levelbonus = (*LInfo)->lvStBonus;/* starting bonus (mz)     */
  189.         thislev=(*LInfo)->lvNext + 1;                    /* choose odd lvls only(mz) */
  190.         
  191.         ReleaseResource(LCTable);
  192.         ReleaseResource(LInfo);
  193.  
  194.         levcount++;
  195.     }    while(thislev != 128 && levcount < MAXSELECTABLES && (levcount <= (int)(highestLastLevel/2) || PlayOptions->restart));
  196.     /* while cond will let player start up to highest odd level completed in last game (mz)    */
  197.     /* if in arcade mode (PlayOptions->restart==0), else PlayOptions->restart==1 so  */
  198.     /* the cond will contribute a true to the while() test.                             */
  199.     
  200.     return    levcount;
  201. }
  202.  
  203. int        DoLevelSelect(highestLastLevel)
  204. int highestLastLevel;
  205.  
  206. {...
  207.  
  208. LastLevel=LastSelect=CreateStable(stable,*highestLastLevel)-1;
  209.  
  210. .....}
  211.  
  212. ==========
  213. to add a starting bonus I changed CreateSTable, as shown above to include the levelBonus
  214. field.
  215.  
  216. and in DoLevelSelect()
  217.  
  218.         /* print level number below box */
  219.         levelnum = thelevel+(theoffset>BoxSize.h/2 ? 1:0);
  220.         VADrawPadNumber(stable[levelnum].levelnumber
  221.                         ,2*BoxSize.h+BoxSize.h/2,VA.frame.bottom-4*VA.segmscale,3);
  222.     
  223.         /* show starting level bonus on top of box */
  224.         VADrawPadNumber(stable[levelnum].levelbonus,2*BoxSize.h+BoxSize.h/2 +3*VA.segmscale,
  225.                         VA.frame.bottom-(BoxSize.v)*(1.6),6);
  226.                         
  227. in GameLoop.c, I added a flag which flipped when the first level was cleared.
  228.  
  229. void    GameLoop(Options)
  230. int        Options;
  231. {
  232.     int            i;
  233.     int            startLevel=0;        /* flag for starting level (mz) */
  234.     
  235. .....and added to the FlyThru section...
  236.  
  237.         if(Hero.state == HeroPlaying)
  238.             {    if(ThisLevel.edgeCount==ThisLevel.totalCount)
  239.                 {    Hero.endtimer--;
  240.                     if(Hero.endtimer<=0)
  241.                     {    Hero.state=HeroFlying;
  242.                         Hero.flydepth=0;
  243.                         if (!(startLevel))    /* check for starting level bonus (mz) */
  244.                             startLevel=1;
  245.                         levelComplete=1;
  246.                         levelStBonus=ThisLevel.lvStBonus;
  247.                         levelBonus=ThisLevel.lvBonus;
  248.                         
  249.                     }
  250.                 }
  251.             }
  252.         
  253.  
  254. further up, I added...
  255.  
  256.         if(Hero.state != HeroDead)
  257.         {    AddLife();
  258.             STLoadLevel();
  259.             CreateFit();
  260.             if (levelComplete == 1)
  261.             {
  262.                 if (startLevel==1)    /* check for starting level bonus (mz) */
  263.                 {
  264.                     startLevel++;
  265.                     IncreaseScore(levelStBonus); 
  266.                 } 
  267.                 IncreaseScore(levelBonus);
  268.             }
  269.             levelComplete = 0;
  270.             levelBonus = 0;
  271.             levelStBonus = 0;
  272.         }                    
  273. Ths way, the bonus would only be given at the beginning of the next level.  This made
  274. sure that the player did not die during the FlyThru and receive the bonus.
  275.  
  276. ==============
  277. An end of level bonus was added with adding to GameLoop.c as shown in the clip above.
  278.  
  279. ==============
  280. I updated the Advertise part of STLevelSelect.c
  281.  
  282. ==============
  283.  
  284. To use the new title animations, I made changes to Flashmain.c
  285.  
  286. in main()
  287.  
  288. case LOGOSTART:
  289.             titlemain(ARASHIPICT, HORIZONTAL);  /*  */
  290.             VASetColors(ColorHandle);
  291.             SpecialEvent = NOEVENT;
  292.             break;
  293.  
  294. all of the other LOGO cases were dropped.  variables were defined in demomain.h 
  295. (from the PolyGet folder)
  296. #define    ARASHIPICT         131
  297. #define    GAMEOVERPICT    133
  298. #define    HORIZONTAL        1
  299. #define    VERTICAL        2
  300.  
  301. and in Flash.h....
  302.  
  303. /* void Logo(); */
  304.  
  305. I commented out the Logo fcn to avoid a re-declaration.
  306.  
  307. and added the demomain.c file to the project.  I also removed the Logoeffects.c file
  308. from the project.  I had to change the main() fcn in demomain.c to titlemain().
  309.  
  310. to use the end of game msg I also had to change Highscores.c
  311.  
  312. #include "demomain.h"
  313.  
  314. in Highscores()
  315.  
  316.     /* GameOver(); */
  317.     titlemain(GAMEOVERPICT, VERTICAL);
  318.     
  319. in demomain.c, all of my changes were to the titlemain() fcn.  I added a doneOnce 
  320. variable to tell when the animation was done.  I removed the display of the 
  321. numbers in the upper right corner, I set up different dwseep varibale for
  322. HORIZONTAL and VERITCAL fades, also changed the search through the line segments
  323. idepending upon the fade direction.  
  324. ==============
  325.  
  326. I also changed the text messages in FlashMain.c main()
  327. case 10:
  328.                     ClearText();    
  329.                     BoxActive = 0;    
  330.                     /* SpecialEvent = DELAY;    */
  331.                     break;    
  332.                 case 11:
  333.                 case 12:
  334.                 case 13:
  335.                     break;
  336.                 case 14:
  337.                     InitZoomer(); 
  338.                     break;
  339.  
  340. I nixed the text msgs 2 and 3, and added a BoxActive=0.  I did this because I think
  341. it contributed to extra boxes showing up during the SpecialEvent=Delay case.
  342.  
  343. ==============
  344.  
  345. I changed the file signature to AR|F'
  346.  
  347. Cleared the high scores, and changed various things in the RSRC file.
  348.  
  349. I changed the volume keys to + and -.
  350.  
  351. ==============
  352. for the superzap sound, I added to STPlayer.c in UpdatePlayer()
  353. if(ThisLevel.plSuperZaps>0)
  354.             {    ThisLevel.plSuperZaps--;
  355.                 Hero.superzapping= 1;
  356.                 PlayB(ZZSuperZap,998);  
  357.                 if(!PlayOptions->noLoudSounds)
  358.                     PlayA(ZZSuperZap,998);
  359.  
  360. ==============
  361. for only saving only Aracde mode scores I added some conditions in Highscores.c
  362.  
  363. in highscores()
  364.  
  365. if (PlayOptions->restart == 0)
  366.     {
  367.         /* read scores from resources */
  368.         ScoreHand=GetResource('SCOR',128);
  369.         HLock(ScoreHand);
  370.         HiScores=(Initials *)*ScoreHand;
  371.         ranking = Ranking(score);
  372.     }
  373.     .
  374.     .
  375.     .
  376.     if (PlayOptions->restart == 0)
  377.     {
  378.         if(ranking<11)
  379.             WriteCongrats();
  380.         else if(ranking<51)
  381.             WriteCongrats2();
  382.         else {
  383.             WriteNoCongrats(score);
  384.             VAEraseBuffer();
  385.             return;
  386.         }
  387.     }        
  388.     else {
  389.         WriteScoreNotSaved();
  390.         VAEraseBuffer();
  391.         return;
  392.     }
  393.     
  394. and added the fcn WriteScoreNotSaved.
  395. ==============
  396. and finally, I think, to correct the Highscore phantoms, 
  397.  
  398. in ScrollScores()
  399.  
  400. for(i=1;(i<=rank+2) && (i<51) ;i++) {   /* extra check on high score (mz) */
  401.             y=sy+(i-1)*(VA.segmscale*4+4);
  402.             if( y >= VA.frame.bottom/4 && y < (VA.frame.bottom-(VA.segmscale*4+4))) {                
  403.                 
  404.                 ........
  405.                 
  406.                 }
  407.                 if((i==rank+2) || (i==50)) {  /* erase all 50's (mz) */